﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using SbsSW.SwiPlCs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Adventure.Model
{
    internal class Scenario
    {
        #region Constructors

        internal Scenario(Rectangle bounds, string name, Color color, Vector2 offset)
        {
            _bounds = bounds;
            _name = name;
            _color = color;
            _offset = offset;
        }

        #endregion

        #region Private Fields

        private Rectangle _bounds;
        private List<Gate> _gates = new List<Gate>();
        private List<Wall> _walls = new List<Wall>();

        #endregion

        #region Attributes and Properties

        private string _name;
        internal string Name
        {
            get { return _name; }
        }

        private Color _color;
        internal Color Color
        {
            get { return _color; }
        }

        private Vector2 _offset;
        internal Vector2 Offset
        {
            get { return _offset; }
        }

        #endregion

        #region Internal Methods

        internal void AddWall(Wall wall)
        {
            _walls.Add(wall);
        }

        internal void AddGate(Gate gate)
        {
            _gates.Add(gate);
        }

        internal void Initialize()
        {
            foreach (var wall in _walls)
                wall.Initialize();

            foreach (var gate in _gates)
                gate.Initialize();
        }

        internal void Update(GameTime gameTime, int time)
        {
            foreach (var gate in _gates)
                gate.Update(gameTime, time);
        }

        internal void UpdateData(int time)
        {
            foreach (var gate in _gates)
                gate.UpdateData(time);
        }

        internal void Draw(GameTime gameTime)
        {
            foreach (var wall in _walls)
                wall.Draw(gameTime);

            foreach (var gate in _gates)
                gate.Draw(gameTime);
        }

        #endregion
    }
}